package com.itheima;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Demo4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请选择主题：1.xxxx年xx月xx日，2.xxxx-xx-xx，3.xxxx/xx/xx");
        String s = sc.next();
        switch (s){
            case "1":
                //System.out.println("主题切换成功,当前时间为:");
                method("yyyy年MM月dd日");
                break;
            case "2":
                //System.out.println("主题切换成功,当前时间为:");
                method("yyyy-MM-dd");
                break;
            case "3":
                //System.out.println("主题切换成功,当前时间为:");
                method("yyyy/MM/dd");
                break;
            default:
                System.out.println("很抱歉，操作有误，已为您切换默认主题");
                method("yyyy年MM月dd日");
        }



    }

    public static void method(String mode) {
        Date date = new Date();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat(mode);
        String time = simpleDateFormat.format(date);// ( (new Date() )
        System.out.println("主题切换成功,当前时间为：" + time);
    }
}
